﻿using CoreEx.Database.Metadata;

namespace CoreEx.Database.Linq.Translators
{
    /// <summary>
    /// Represents a valid mapping between a property and a database column or between a property and database table. 
    /// </summary>
    public class MappedProperty
    {
        /// <summary>
        /// Initializes a new instance of the <see cref="MappedProperty"/> class.
        /// </summary>
        /// <param name="propertyMappingInfo">The <see cref="IPropertyMappingInfo"/> that describes the target property.</param>
        /// <param name="tableSource">The <see cref="TableSource"/> instance that this <see cref="MappedProperty"/> belongs to.</param>
        public MappedProperty(IPropertyMappingInfo propertyMappingInfo, TableSource tableSource)
        {
            PropertyMappingInfo = propertyMappingInfo;
            TableSource = tableSource;
        }

        /// <summary>
        /// Gets the <see cref="IPropertyMappingInfo"/> instance that describes 
        /// how a persistable property relates to database table column or foreign key.
        ///  </summary>
        public IPropertyMappingInfo PropertyMappingInfo { get; private set; }

        /// <summary>
        /// Gets the <see cref="TableSource"/> that this <see cref="MappedProperty"/> belongs to.
        /// </summary>
        public TableSource TableSource { get; private set; }        
    }
}